GBML manual / Strings

string_find

The index of the first needle inside s, or -1 if it is not there - finding text inside a string.

Syntax

string_find(s, needle) -> int

Arguments

NameType
sstring
needlestring

Returns

int

Description

The index of the first needle inside s, or -1 if it is not there - finding text inside a string.

string_find(s, needle) == 0 is "does s start with needle"; combine with string_slice for "does it end with needle" (compare the last string_length(needle) characters).

Example

var message = "you found a key!";
var found_key = string_find(message, "key") != -1;

On the GBA

`string_find(s, needle) == 0` is "does s start with needle"; combine with string_slice for "does it end with needle" (compare the last string_length(needle) characters).

See also: string_slicestring_replace